﻿@model Project_KhuyenMaiVang.Models.IndexModel
@{
    ViewBag.Title = "ThongTinGiaoHang";
    Layout = "~/Views/Shared/_LayoutDefault.cshtml";
    Project_KhuyenMaiVang.Models.TinKhuyenMai_SanPham_HinhAnhDTO ChiTietTinKhuyenMai = ViewBag.ThongTinChiTietTinKhuyenMai;
    List<Project_KhuyenMaiVang.Models.HinhThucThanhToanDTO> DsHinhThucThanhToan = ViewBag.ListHinhThucThanhToan;
    var items = new SelectList(DsHinhThucThanhToan, "MaHinhThucThanhToan", "TenHinhThucThanhToan");
        
    List<Project_KhuyenMaiVang.Models.TinKhuyenMai_SanPham_HinhAnhDTO> ListKhuyenMaiHot = ViewBag.DSKhuyenMaiHot;
}
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#ThongTinGiaoHang").hide();
        $("#continue02").hide();
        $("#continue03").hide();
        $("#HinhThucThanhToan").hide();

        $("#continue01").click(function () {
            $("#ThongTinGiaoHang").show(1500);
            $("#continue02").show(1500);
        });
        
        $("#continue02").click(function () {
            $("#HinhThucThanhToan").show(1500);
            $("#continue03").show(1500);
        });
    });

    function caculate(priceEle, quanEle, resultEle) {
        resultEle.value = priceEle.value * quanEle.value;
    }
</script>
  
  
<div id="ChiTietSanPham" align="center">
    @using (Html.BeginForm())
    {
            <table width="100%" border="0">
        <tr>
            <p align="center" style="font-weight:bold">ĐƠN ĐẶT HÀNG</p>
        </tr>
        <tr>
            <td bgcolor="#83B252"><span class="style7">Tên sản phẩm</span></td>
            <td bgcolor="#83B252"><span class="style7">Số lượng</span></td>
            <td bgcolor="#83B252"><span class="style7">Đơn giá</span></td>
            <td bgcolor="#83B252"><span class="style7">Thành tiền</span></td>
        </tr>
        <tr>
            <td>@ChiTietTinKhuyenMai.TenSanPham</td>
            <td><input name="quantity" type="text" id="quantityID" onChange="caculate(document.getElementById('priceID'),document.getElementById('quantityID'),document.getElementById('resultID'))"/></td>
            <td><input readonly="readonly" name="price" id = "priceID" value="@ChiTietTinKhuyenMai.GiaKhuyenMai" type="text"/></td>
            <td><input readonly="readonly" name="result" id = "resultID" type="text"/></td>    
        </tr>
    </table>
    <p align="right"><img id="continue01" src="@Url.Content("~/Content/Images/continue-button.png")" width="152" height="28" /></p>
    <table id="ThongTinGiaoHang" width="300px" border="0">
        <tr>
            <td colspan="2" align="center"><strong>THÔNG TIN GIAO HÀNG</strong></td>
        </tr>
        <tr>
            <td width="23%" bgcolor="#83B252"><span class="style7 style7">Họ tên:</span></td>
            <td width="77%">

                @Html.EditorFor(model => model.ThongTinGiaoHangModel.ThongTinGiaoHang.HoTen)    </td>
        </tr>
        <tr>
            <td bgcolor="#83B252"><span class="style7">Địa chỉ</span></td>
            <td><form id="form4" name="form4" method="post" action="">
                    <label>
                        @Html.EditorFor(model => model.ThongTinGiaoHangModel.ThongTinGiaoHang.DiaChi) 
                    </label>
                </form>    </td>
        </tr>
  
        <tr>
            <td bgcolor="#83B252"><span class="style7">Điện thoại</span></td>
            <td><form id="form4" name="form4" method="post" action="">
                    <label>
                        @Html.EditorFor(model => model.ThongTinGiaoHangModel.ThongTinGiaoHang.DienThoai) 
                    </label>
                </form>    </td>
        </tr>
        <tr>
            <td bgcolor="#83B252" style="color:#FFFFFF">CMND</td>
            <td><form id="form4" name="form4" method="post" action="">
                    <label>
                        @Html.EditorFor(model => model.ThongTinGiaoHangModel.ThongTinGiaoHang.Cmnd) 
                    </label>
                </form>    </td>
        </tr>
    </table>
    <p align="right"><img id="continue02" src="@Url.Content("~/Content/Images/continue-button.png")" width="152" height="28" /></p>
    <table id="HinhThucThanhToan"  width="300PX" border="0">
        <tr>
            <td align="center" colspan="2"><strong>HÌNH THỨC THANH TOÁN</strong></td>
        </tr>
        <tr>
            <td width="100px" bgcolor="#83B252" style="color:#FFFFFF">Hình thức:</td>
            <td> @Html.DropDownListFor(model => model.ThongTinGiaoHangModel.ThongTinDonDatHang.MaHinhThucThanhToan, items) </td>
        </tr>
    </table>

        <p align="right"><input type="image" id="continue03" src="@Url.Content("~/Content/Images/continue-button.png")" width="152" height="28" /></p>
    <p>&nbsp;</p>
    }
    

</div> 
  

<div class="ListSanPhamCungLoai">
    
      <div class="ListKhuyenMaiHot_TieuDe">
        <div align="center"><strong>Khuyễn mãi <span class="style11">HOT</span></strong></div>
      </div>
      <div class="HinhHotDeal"><img src="@Url.Content("~/Content/Images/hotdeal.png")" width="103" height="40" /></div>
      <p>&nbsp;</p>
          <div class="ListTinKhuyenMaiHot">
          @foreach(var Item in ListKhuyenMaiHot)
          {
              String tenhinh;              

              if (Item.ListHinhAnh.Count > 0)
              {
                  tenhinh = Item.ListHinhAnh[0].TenHinhAnh;
              }
              else
              {
                  tenhinh = "cafe.jpg";
              }
              var PTGiamGia = (int) ((float) (Item.GiaGoc - Item.GiaKhuyenMai)/Item.GiaGoc*100);
              <div class="MauTinKhuyenMaiHot">      	
              <div class="MauTinKhuyenMai_TieuDe">@Html.ActionLink(Item.TenSanPham, "XemChiTietSanPham", new { idSanPham = Item.MaTinKhuyenMai })</div>        
              <div class="MauTinKhuyenMai_HinhAnh"><img src="@Url.Content("~/Content/Images/"+tenhinh)" width="227" height="130" /></div>
              <div class="MauTinKhuyenMai_PhanTram">
                  <p align="center"><br/>Giảm<br />
                      @PTGiamGia%
                  </p>
              </div>
              <div class="MauTinKhuyenMai_GiaBan">
                  <div class="MauTinKhuyenMai_Gia">@Item.GiaKhuyenMai<br />
                      VNĐ</div>
              </div>
          </div>  
          }
           
                                           
      </div>
    
    </div>
  <div class="clearboth"></div>
  
